<template>
  <div class="p-3">
    <a-card style="height: 820px" :bordered="false">
      <a-table
        :columns="columns"
        :data-source="dataSource"
        bordered
        :pagination="pagination"
        class="mt-5"
        :scroll="{ x: 600 }"
      ></a-table>
    </a-card>
  </div>
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue';
import { getNoticeCenterInfo } from '#/api/core/setting';
const columns = [
  {
    title: '归属机构',
    dataIndex: 'belongComName',
    key: 'belongComName',
    align: 'center',
  },
  {
    title: '通知标题',
    dataIndex: 'noticeName',
    key: 'noticeName',
    align: 'center',
  },
  {
    title: '通知类型',
    dataIndex: 'noticeType',
    key: 'noticeType',
    align: 'center',
  },
  {
    title: '申请时间',
    dataIndex: 'createTime',
    key: 'createTime',
    align: 'center',
  },
  {
    title: '发布人',
    dataIndex: 'createPersonName',
    key: 'createPersonName',
    align: 'center',
  },
  {
    title: '发布状态',
    dataIndex: 'status',
    key: 'status',
    align: 'center',
  },
  {
    title: '最后更新时间',
    dataIndex: 'updateTime',
    key: 'updateTime',
    align: 'center',
  },
  {
    title: '通知内容',
    dataIndex: 'noticeContent',
    key: 'noticeContent',
    align: 'center',
  },
];
const dataSource = ref([]);
const pagination = reactive({
  total: 0,
  pageSize: 10,
  current: 1,
  showSizeChanger: true,
  showQuickJumper: true,
  showTotal: (total: number) => `共 ${total} 条`,
  onChange: (page: number, pageSize: number) => {
    pagination.current = page;
    pagination.pageSize = pageSize;
    onSearch();
  },
});
const onSearch = () => {
  const query = {
    page: pagination.current,
    limit: pagination.pageSize,
  };
  getNoticeCenterInfo(query).then((res: any) => {
    // console.log(res);
    dataSource.value = res.data.data;
    pagination.total = res.data.total;
  });
};
onSearch();
</script>
<style scoped></style>
